package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.OmcMenuMapper;
import com.csun.cmny.provider.model.domain.OmcMenu;
import com.csun.cmny.provider.model.vo.OmcMenuVo;
import com.csun.cmny.provider.service.OmcMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class OmcMenuServiceImpl extends BaseService<OmcMenu> implements OmcMenuService {
    @Resource
    private OmcMenuMapper  omcMenuMapper;

    /**
     * 批量更新菜谱
     * @param menus
     * @return
     */
    @Override
    public int batchUpdate(List<OmcMenu> menus) {
        int count = 0;
        for (OmcMenu omcMenu: menus) {
            int n = omcMenuMapper.updateByPrimaryKeySelective(omcMenu);
            count = count + n;
        }
        return count;
    }

    /**
     * 根据日期和机构Id查询出一周菜谱
     * @param omcMenu
     * @return
     */
    @Override
    public List<OmcMenuVo> selectByDayAll(OmcMenu omcMenu) {
        return omcMenuMapper.selectByDayAll(omcMenu);
    }
}
